<template>
  <div style="display: inline">
    <el-button @click="ignoreOrder" type="info" :disabled="orderIds.length === 0" class="mgr10 mgb10">忽略</el-button>
  </div>
</template>

<script>

import {ignoreOrder} from "@/api/order";

export default {
  name: "IgnoreOrder",
  props:{
    orderIds:{
      type: Array,
      require: true,
    },
  },
  data(){
    return {

    };
  },
  methods:{
    ignoreOrder() {
      this.$confirm('忽略后该订单<br/>1、将不再提示该订单的处理<br/>2、不计入系统的代发单数', '确认忽略该订单？', {
        dangerouslyUseHTMLString: true,
        confirmButtonText: '确定',
        cancelButtonClass: '取消'
      })
        .then(res=>{
          // 点击了确定
          const postData = {
            orderIds : this.orderIds,
          }
          ignoreOrder(postData)
            .then(res=>{
              if(res.error === 0){
                this.$successMessage(res.message)
                this.$emit('changeOrder',true)
              }else{
                this.$errorMessage(res.message)
              }
            })
        })
        .catch(res=>{
          // 点击了取消
        });
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
